﻿@model SDSystem.Models.Dish
@*//////////////////////////////////////////////////////////////////////Ext Form
@using Ext.Net
@using Ext.Net.MVC
@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@(Html.X().FormPanel()
      .ID("CreateDishesView")
      .BodyPadding(5)
      .Buttons(buttons =>
                   {
                       buttons.Add(
                           Html.X().Button().Text("Save").Icon(Icon.Disk).DirectEvents(
                               de =>
                                   {
                                       de.Click.IsUpload = true;
                                       de.Click.Confirmation.ConfirmRequest = true;
                                       de.Click.Confirmation.Title = "Save";
                                       de.Click.Confirmation.Message = "Confirm?";
                                       de.Click.Url = Url.Action("Create");
                                       de.Click.EventMask.ShowMask = true;
                                       de.Click.FormID = "CreateDishesView";
                                   })
                           );
                       buttons.Add(
                           Html.X().Button().Text("Back").Icon(Icon.PreviousGreen)
                           );
                   })
      .Items(
          Html.X().FieldSet().Title("Dishes Details").Layout(LayoutType.Form).Padding(5).Items(
              Html.X().TextFieldFor(m=>m.Name).FieldLabel("GroupNews Name").LabelWidth(100).Width(600).LabelAlign(LabelAlign.Top),
              Html.X().FileUploadField().ID("imgUpload").FieldLabel("Upload Image").Text("Image Url").LabelWidth(100).Width(600).LabelAlign(LabelAlign.Top),
              Html.X().HtmlEditorFor(m => m.Description).FieldLabel("Description").Height(150).LabelWidth(100).LabelAlign(LabelAlign.Top),
              Html.X().HtmlEditorFor(m => m.Recipe).FieldLabel("Recipe").Height(150).LabelWidth(100).LabelAlign(LabelAlign.Top),
              Html.X().HtmlEditorFor(m => m.Resource).FieldLabel("Resource").Height(150).LabelWidth(100).LabelAlign(LabelAlign.Top),
              Html.X().ComboBoxFor(m=>m.GroupDishes).FieldLabel("Group Dishes").LabelWidth(150).Width(600).LabelAlign(LabelAlign.Top)
              )))
//////////////////////////////////////////////////////////////////////////*@
@{
    ViewBag.Title = "Create Dishes";
    Layout = "~/Views/Shared/_LayoutHtml.cshtml";
}
@using(Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Image)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Image,new {@id="DishImage"})
            @Html.ValidationMessageFor(model => model.Image)
            <input type="button" value="Browser..." id="btnImage"/>
            <script type="text/javascript">
                $(document).ready(function () {
                    $("#btnImage").click(function () {
                        var ckImage = new CKFinder();
                        ckImage.selectActionFunction = function (fileUrl) {
                            $("#DishImage").val(fileUrl);
                        };
                        ckImage.popup();
                    });
                });
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Description, new { @id = "descriptionCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("descriptionCk"
                //                    ,{
                //                        toolbar : 'Basic'
                //                    }
                );
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.DContent)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.DContent, new { @id = "contentCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("contentCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Recipe)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Recipe, new { @id = "recipeCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("recipeCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Resource)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Resource, new { @id = "resourceCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("resourceCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.GroupDishes)
        </div>
        <div class="editor-field">
            @Html.DropDownList("ListGroupDishes", (IEnumerable<SelectListItem>)ViewBag.ListGroupDishes,"----------Select GroupDishes----------")
        </div>
        <br/>
        <p>
            <input type="submit" name="btnCreate" value="Create"/>
            <input type="submit" name="btnPreview" value="Preview"/>
        </p>
    </fieldset>
}